package com.kob.backend.service.impl.utils;

import com.kob.backend.pojo.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDetailsImpl implements UserDetails {
    private User user;
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }
    @Override
    public String getPassword() {
        return user.getPassword();
    }
    @Override
    public String getUsername() {
        return user.getUsername();
    }
    @Override
    public boolean isAccountNonExpired() {//账号是否未过期
        return true;//没有过期
    }
    @Override
    public boolean isAccountNonLocked() {//账号是否未锁定
        return true;//没有锁定
    }
    @Override
    public boolean isCredentialsNonExpired() {//身份是否未过期
        return true;//没有过期
    }
    @Override
    public boolean isEnabled() {//账号是否可用
        return true;//可用
    }
}
